
import dao.UserDao;
import entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Administrator on 2018/3/13 0013.
 */
public class Demo1 {

    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring.xml");
        UserDao userDao = (UserDao) applicationContext.getBean("userDao");

        User user = new User();
        user.setId(1);
        user.setName("obama");
        userDao.saveUser(user);
        User user2 = userDao.getUser(1);
        System.out.println(user2.getName());


    }
}
